act_site = [1 2 4 7 8];
pas_site = [3 5 6 9];
con_site = 10;

for site = 1:9
    for layer = 1:4
        for time_pt = 1:4
            for cell_id = 1:size(proj_meta(site).rd(layer,1).act,1);
                act = proj_meta(site).rd(layer,time_pt).act(cell_id,7501:15000);
                act = act-1.2;
                act(act < 0) = 0;
                auc{site,layer,time_pt,cell_id} = sum(act);
            end
        end
    end
end

for site = 1:9
    for layer = 1:4
        for cell_id = 1:size(proj_meta(site).rd(layer,1).act,1);
            all_auc = horzcat(auc{site,layer,:,cell_id});
            auc_by_cell{site,layer,cell_id} = mean(all_auc);
        end
    end
end

mean_auc_act = mean([auc_by_cell{act_site,:,:}]);
mean_auc_pas = mean([auc_by_cell{pas_site,:,:}]);

sem_auc_act = std([auc_by_cell{act_site,:,:}])/sqrt(996);
sem_auc_pas = std([auc_by_cell{pas_site,:,:}])/sqrt(764);